extends layout.pug

block content

  div.row
    div.col-sm-offset-0.col-sm-8
      - for (var i=0; i<articles.length; i++)
        - var article = articles[i];
          article.article-body
            header
              h1(style="margin-bottom: 4px;")
                a.article-title(href="/article/"+article.id)= article.title
            div.article-meta.clearfix
              if (article.top)
                span.text-danger
                  i.fa.fa-angellist
                  = " 已置顶(^.^)"
              time.article-datetime
                i.fa.fa-calendar(aria-hidden="true")
                = " "+article.time
              div.pull-right
                if (login)
                  span.article-delete(data-del=JSON.stringify({title: article.title, id: article.id}))
                    i.fa.fa-close(aria-hidden="true")
                    = " 删除"
                  a.article-update(href="/admin?update="+article.id)
                    i.fa.fa-pencil(aria-hidden="true")
                    = " 编辑"
            div.article-inner
              != article.summary
              p.text-left(style="margin-top: 10px")
                a.btn.btn-primary(href="/article/"+article.id)= "查看全部 "
                  span.fa.fa-chevron-right
            footer.article-footer
              ul.tags-list
                - var tags = article.tags || [];
                - for (var j=0; j<tags.length; j++)
                  - var name = tags[j];
                    li.tag-item
                      a.tag-link(href="/tag/"+name)= name

      nav.text-center
        - var curr = page.curr, from = page.from, to = page.to, total = page.total;
        ul.pagination
          li(class=(curr==1&&"disabled"))
            if(curr==1)
              span.page-prev(href="/page/"+(curr-1) rel="prev")= "上一页"
            else
              a.page-prev(href="/page/"+(curr-1) rel="prev")= "上一页"
          - for (var i=from; i<=to; i++)
            li(class=(curr==i&&"active"))
              a(href="/page/"+i)= i
          li(class=(curr==total&&"disabled"))
            if(curr==total)
              span.page-next(rel="next" href="/page/"+(curr+1))= "下一页"
            else
              a.page-next(rel="next" href="/page/"+(curr+1))= "下一页"

    div.col-sm-3.col-sm-offset-1
      include template/sidebar.pug